/*
 * @Author: 谢陈洁
 * @Date: 2025-07-18 13:26:47
 * @LastEditors: 谢陈洁
 * @LastEditTime: 2025-07-18 15:55:47
 * @Description: file content
 */
import { getRoleList } from "@/services/apis/system/role";
import { getRoutes } from '@/services/apis/system/route'
import { defineStore } from "pinia";

export const usePermissionStore = defineStore('permission', {
  state: () => ({
    routes: [], // 路由
    addRoutes: [], // 新增的路由
    roles: [], // 角色
    permissions: [],
  }),
  actions: {
    // 获取角色列表
    async getRoles(params?: Record<string, any>) {
      const res = await getRoleList(params)
      this.roles = res.list
    },

    // 获取权限列表
    async getPermissions() {
      const res = await getRoutes()
      console.log(res)
      this.permissions = res.list
    },
  }
})
